﻿using EFCoreToApi.BLL.IService;
using EFCoreToApi.Models;
using EFCoreToApi.Models.Model;
using System.Collections.Generic;

namespace EFCoreToApi.BLL.Service
{
    public class StudentService : IStudentService
    {
        protected IRepository<Student> _studentRepository;
        public StudentService(IRepository<Student> studentRepository)
        {
            _studentRepository = studentRepository;
        }

        public bool delOneStudentById(int id)
        {
            return _studentRepository.Delete(id);
        }

        public bool editOneStudentByDto(Student dto)
        {
            return _studentRepository.UpdateOk(dto);
        }

        public List<Student> getAllStudentsLists()
        {
            return _studentRepository.SelectAll();
        }

        public Student getOneStudentById(int id)
        {
            return _studentRepository.SelectById(id);
        }
    }
}
